﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="SharingCenter.Web.Admin.User.Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitlePlaceHolder" runat="server">
    用户总览
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .ut
        {
            border-collapse: collapse;
        }
        .ut td, .ut th
        {
            border: 1px solid #ccc;
            padding: .5em 1em;
        }
        
        #userinfopane
        {
            width: 500px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManagerProxy runat="server">
        <Scripts>
            <asp:ScriptReference Path="~/Admin/User/Default.js" />
        </Scripts>
    </asp:ScriptManagerProxy>
    <h2>
        找到
        <asp:Label ID="lblUserCount" runat="server"></asp:Label>
        条记录</h2>
    <div class="ctn3">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:ListView ID="lvUsers" runat="server" DataSourceID="LinqDataSource1" DataKeyNames="UserId">
                    <LayoutTemplate>
                        <table class="ut" id="ut">
                            <tr class="alt">
                                <th>
                                    E-mail
                                </th>
                                <th>
                                    昵称
                                </th>
                                <th>
                                    注册日期
                                </th>
                                <th>
                                    已验证
                                </th>
                                <th>
                                    已禁用
                                </th>
                                <th>
                                    操作
                                </th>
                            </tr>
                            <tr id="itemPlaceholder" runat="server" />
                        </table>
                    </LayoutTemplate>
                    <ItemTemplate>
                        <tr class="<%#(Container.DisplayIndex+1) % 2 == 0 ? "alt" : "" %>">
                            <td>
                                <asp:HyperLink runat="server" CssClass="pointer" rel="infopaneopener" uid='<%#Eval("UserId") %>'>
                                    <asp:Label ID="Label1" runat="server" Text='<%#Eval("Email") %>'></asp:Label>
                                </asp:HyperLink>
                            </td>
                            <td>
                            <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%#Eval("UserId", "~/Home/?id={0}") %>'
                                    Target="_blank">
                                <cc:AvatarImage runat="server" AvatarType="Thumbnail" UserId='<%#Eval("UserId") %>'
                                    Height="16" CssClass="bdr-all" BorderWidth="1" /></asp:HyperLink>
                                <asp:HyperLink runat="server" NavigateUrl='<%#Eval("UserId", "~/Home/?id={0}") %>'
                                    Target="_blank">
                                    <asp:Label ID="lblNickName" runat="server"></asp:Label></asp:HyperLink>
                            </td>
                            <td>
                                <asp:Label ID="Label3" runat="server" Text='<%#Eval("CreateDate", "{0:yyyy-MM-dd}") %>'></asp:Label>
                            </td>
                            <td align="center">
                                <asp:Image runat="server" ImageUrl="~/Content/images/icons/tick_circle.png" Visible='<%#Eval("IsApproved")%>'
                                    AlternateText="是" ToolTip="是" />
                            </td>
                            <td align="center">
                                <asp:Image ID="Image1" runat="server" ImageUrl="~/Content/images/icons/block_16.png"
                                    Visible='<%#Eval("IsLockedOut")%>' AlternateText="已禁用" ToolTip="已禁用" />
                            </td>
                            <td>
                                <%--<asp:LinkButton ID="LinkButton4" runat="server" CommandName="EditProfile" CssClass="editprofile openmodalformbutton-nostyle">修改信息</asp:LinkButton>
                                |--%>
                                <asp:LinkButton ID="LinkButton1" runat="server" Visible='<%#!Convert.ToBoolean(Eval("IsLockedOut")) %>'
                                    CommandName="LockUser" CommandArgument='<%#Eval("UserId") %>'>禁用</asp:LinkButton>
                                <asp:LinkButton ID="LinkButton2" runat="server" Visible='<%#Convert.ToBoolean(Eval("IsLockedOut")) %>'
                                    CommandName="UnlockUser" CommandArgument='<%#Eval("UserId") %>'>启用</asp:LinkButton>
                                |
                                <asp:LinkButton ID="LinkButton3" runat="server" CommandName="DeleteUser" CommandArgument='<%#Eval("UserId") %>'>删除</asp:LinkButton>
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:ListView>
                <div class="ctn-p-t">
                    <asp:DataPager ID="DataPager1" runat="server" PagedControlID="lvUsers" PageSize="10" QueryStringField="p">
                        <Fields>
                            <asp:NextPreviousPagerField ShowFirstPageButton="true" ShowLastPageButton="true"
                                ShowNextPageButton="false" ShowPreviousPageButton="false" ButtonType="Link" />
                        </Fields>
                    </asp:DataPager>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
        <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="SharingCenter.Web.Classes.scDataContext"
            OrderBy="Email" Select="new (Email, IsApproved, UserId, IsLockedOut, CreateDate, LastLoginDate, LastPasswordChangedDate, NickName, FullName, BirthDate, Country, City, Province, AvatarImage)"
            TableName="ProfileMemberships">
        </asp:LinqDataSource>
    </div>
    <div class="dialogform" title="用户信息">
        <div id="userinfopane">
            <div class="fc">
                <table class="tb-full">
                    <tr>
                        <td style="width:80px;">昵称：</td>
                        <td id="u-NickName"></td>
                    </tr>
                     <tr>
                        <td>性别：</td>
                        <td id="u-Gender"></td>
                    </tr>
                    <tr>
                        <td>姓名：</td>
                        <td id="u-FullName"></td>
                    </tr>
                     <tr>
                        <td>生日：</td>
                        <td id="u-BirthDate"></td>
                    </tr>
                    <tr>
                        <td>现居：</td>
                        <td>
                           <span id="u-Country"></span> 
                           <span id="u-Province"></span>
                           <span id="u-City"></span>
                        </td>
                    </tr>
                    <tr>
                        <td>兴趣爱好：</td>
                        <td id="u-Interest"></td>
                    </tr>
                    <tr>
                        <td>领域专长：</td>
                        <td id="u-Speciality"></td>
                    </tr>
                    <tr>
                        <td colspan='2'>
                            <span class="closemodalformbutton">关闭</span>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
</asp:Content>
